#!/bin/sh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o xtrace
set -o errexit

# install basic soft
apt-get update
apt-get install -y net-tools
apt-get install -y vim
apt-get install -y git
apt-get install -y subversion
apt-get install -y apt-utils libelf-dev build-essential libssl-dev python3 wget gdb autoconf libtool automake bzip2 debhelper dh-autoreconf openssl libnetfilter-conntrack-dev libmnl-dev

# Use this directory to get source code.
mkdir -p /home/pmlcode

# make and install ovs
cd /home/pmlcode
git clone -b branch-2.15 http://172.17.9.116/cnos-dcn/ovs2021.git
cd ovs2021
./boot.sh && ./configure && make install

# make and install ovn
cd ..
git clone -b branch-21.03 http://172.17.9.116/cnos-dcn/ovn2021.git
cd ovn2021
./boot.sh && ./configure --with-ovs-source=${PWD}/../ovs2021 --with-ovs-build=${PWD}/../ovs2021
make install

# set envirment
export PATH=$PATH:/usr/local/share/openvswitch/scripts
export PATH=$PATH:/usr/local/share/ovn/scripts